// pages/homepage/majordoctor/majordoctor.js
var app = getApp();
Page({
  data: {
    id:'',
  },
  onReady: function () {
  },
  onShow: function () {
  },
  onShareAppMessage: function () {
  },


  onLoad: function (e) {
    var that = this
    console.info('--------' + e.abc);
    this.setData({
      id: e.abc,
    });
    console.info('--------' + e.abc);
    var id =this.data.id;
    //id = e.id;
    console.log('用户id值为'+id),
      wx.request({
        url: app.globalData.url + '/API/majordoctor?id=' + id,
        method: 'get',
        header: {
          'content-type': 'application/json'
        },
        success: function (res) {
          console.log(res.data);
          var list = res.data;
          if (list == null) {
            var toastText = '医生数据获取失败';
            wx.showToast({
              title: toastText,
              icon: '',
              duration: 2000
            });
          } else {
            that.setData({
              list: list
            })
          }
        },
        fail: function () {
          console.log("------------fail-------------");
        }
      })
  },
  return: function () {
    wx.navigateTo({
      url: '../homepage',
    })
  }
})